const Sequelize = require('sequelize'); //引入Sequelize模块
const db = require('../db');
const Share = require('./share')
const FocusFans = require('./focus_fans')
//定义model
const User = db.define('User',{
    //主键
    id:{type:Sequelize.INTEGER,primaryKey:true,allowNull:false,autoIncrement:true },
    //用户名
    username:{type:Sequelize.STRING(25)},
    //密码
    password:{type:Sequelize.STRING(100)},
    //昵称
    name:{type:Sequelize.STRING(16)},
    //用户头像路径
    avatar:{type:Sequelize.STRING(255)},
    //电话
    phone:{type:Sequelize.STRING(16)},
    //性别
    sex:{type:Sequelize.STRING(2)},
    //冻结状态
    frozen:{type:Sequelize.INTEGER},
    //简介
    controduction:{type:Sequelize.TEXT},
    //创建时间
    created_at:{type:Sequelize.DATE},
    //修改时间
    updated_at:{type:Sequelize.DATE},

}, {
        underscored:true,
        tableName:'user',
        //timestamps: false//禁用创建时间戳
});

User.hasMany(Share, { foreignKey: 'u_id' })

module.exports = User;
